package com.camunda.workflow.camunda;

import com.camunda.workflow.camunda.provider.CustomWritableIdentityProvider;
import com.camunda.workflow.mapper.*;
import org.camunda.bpm.engine.impl.interceptor.Session;
import org.camunda.bpm.engine.impl.interceptor.SessionFactory;

public class CustomIdentityProviderFactory implements SessionFactory {
    private final CustomWritableIdentityProvider customWritableIdentityProvider;

    public CustomIdentityProviderFactory(SysUserMapper sysUserMapper, SysRoleMapper sysRoleMapper, SysTenantMapper sysTenantMapper, SysUserRoleMapper sysUserRoleMapper, SysTenantUserRoleMapper sysTenantUserRoleMapper) {
        super();
        this.customWritableIdentityProvider = new CustomWritableIdentityProvider(sysUserMapper, sysRoleMapper, sysTenantMapper, sysUserRoleMapper, sysTenantUserRoleMapper);
    }

    @Override
    public Class<?> getSessionType() {
        return CustomWritableIdentityProvider.class;
    }

    @Override
    public Session openSession() {
        return this.customWritableIdentityProvider;
    }
}
